home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 September & October
/
Amiga-CD 1996 #9-10.iso
/
ausgabe_9_96
/
kommunikation
/
inetutils-1.4-amitcp
/
contrib
/
mailq.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-09-30
|
2KB
|
83 lines
/*
* Scan the InetUtils SMTPd Queue directory, and show us what's going in
* where what's in the queue is going, and how long it's been there.
*
* Copyright 1994, Mike Meyer (mwm@contessa.phone.net)
*/
/* Output tuning */
queue_len = 20
host_len = 40
/* Make sure we have the libraries */
if ~show('Libraries', 'rexxarplib.library') then
if ~addlib('rexxarplib.library', 0, -30) then do
say "No rexxarplib, so we can't scan the spool!"
exit
end
if ~show('Libraries', 'rexxsupport.library') then
if ~addlib('rexxsupport.library', 0, -30) then do
say "No rexxsupport library, so we can't scan the spool!"
exit
end
/* Get the SMTPSPoolDir */
spooldir = getuuenv('SMTPSPOOLDIR')
if spooldir = "" then do
say "Can't find the name of the directory to scan."
exit
end
old = pragma('Directory', spooldir)
/* Get a list of files in it */
count = filelist('X.#?', files)
/* Now, process them */
if count = 0 then
say "No files in the mail queue"
else do
say left("Queue number", queue_len) ,
|| left("Destination host", host_len) || "Time in queue"
say ""
nowdays = date('Internal')
nowminutes = time('Minutes')
do i = 1 to count
parse value files.i with 'X.'queue
parse value statef(files.i) with . . . . filedays fileminutes .
days = nowdays - filedays
minutes = nowminutes - fileminutes
if minutes < 0 then do
days = days + 1
minutes = minutes + 1440
end
hours = 24 * days + minutes % 60
minutes = minutes // 60
destination = getdestination(files.i)
if destination = "" then iterate
out = left(queue, queue_len) || left(destination, host_len)
select
when hours = 0 & minutes = 0 then say out || "no time"
when hours = 0 & minutes = 1 then say out || "1 minute"
when hours = 0 then say out || minutes "minutes"
when hours = 1 & minutes = 0 then say out || "1 hour"
when hours = 1 & minutes = 1 then
say out || "1 hour 1 minute"
when hours = 1 then
say out || "1 hour" minutes "minutes"
when minutes = 0 then say out || hours "hours"
when minutes = 1 then say out || hours "hours 1 minute"
otherwise say out || hours "hours" minutes "minutes"
end
end
end
exit
getdestination: procedure
parse arg file
if ~open(in, file, 'Read') then return ""
host = readln(in)
call close in
return host